#include <iostream>
#include <vector>
#include <regex>
#include <string>
#include <cstring>

using namespace std;
std::vector<std::string> split(const std::string& input,
                               const std::string& regex)
{ 
  std::regex re(regex);
  std::sregex_token_iterator first {input.begin(), input.end(), re, -1}, last;
  return {first, last};
}

int main()
{
    string str;
 while(getline(cin,str))   
 {
     string scout="YES";
     replace(str.begin(),str.end(),'.',',');   /// split 传入 "."会出错，故用，替换
     auto rlt=split(str,",");
     for(auto ele:rlt)
     {
         int num=stoi(ele);
         if(num<0 ||num>255)
         {
             scout="NO";
         }
     }
     cout<<scout<<endl;
 }
    
    
}